<div class="col-xs-6">
    <form class="form-horizontal" role="form">
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('PARENT_ID')}:</label>
            <div class="col-sm-9">
                <select class="form-control" name="pid">
                    <option value="0">一级菜单</option>
                    {$map}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('REAL_NAME')}:</label>
            <div class="col-sm-9">
                <input class="col-xs-6" type="text" name="realname[{$Think.LANG_SET}]" placeholder="{$Think.LANG_SET}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('MODEL')}:</label>
            <div class="col-sm-9">
                <input class="col-xs-6" type="text" name="model"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('ACTION')}:</label>
            <div class="col-sm-9">
                <input class="col-xs-6" type="text" name="action"/>
                <span class="grey ml10 pt5 dib">{:L('DEFAULT')}: index</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('DATA')}:</label>
            <div class="col-sm-9">
                <input class="col-xs-8" type="text" name="data"/>
                <span class="grey ml10 pt5 dib">{:L('SUCH')}: id=1&AMP;type=2</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('REMARK')}:</label>
            <div class="col-sm-9">
                <textarea class="input-xxlarge" name="remark"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">{:L('STATUS')}:</label>
            <div class="col-sm-9">
                <label>
                    <input class="ace ace-switch ace-switch-7" type="checkbox" value="1" checked="checked" name="status"/>
                    <span class="lbl"></span>
                </label>
            </div>
        </div>
        <div class="clearfix form-actions">
            <div class="col-md-offset-3 col-md-9">
                <button class="btn btn-info" type="submit">
                    <i class="glyphicon glyphicon-ok"></i> {:L('SUBMIT')}
                </button>
                <button class="btn" type="reset">
                    <i class="glyphicon glyphicon-repeat"></i> {:L('RESET')}
                </button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var pan = '<li><a class="tarmain" href="{:U(CONTROLLER_NAME.'/index')}">{:L($Think.CONTROLLER_NAME)}</a></li>\n\
<li class="active">{:L($Think.ACTION_NAME)}</li>';
    $('#breadcrumbs .breadcrumb li:gt(0)').remove();
    $('#breadcrumbs .breadcrumb').append(pan);
    $('.page-header h1').empty();
    $('.page-header h1').append('{:L($Think.CONTROLLER_NAME)}<small class="glyphicon glyphicon-chevron-right"> {:L($Think.ACTION_NAME)}</small>');
    $('a.tarmain').click(function(e){
        $.get( $(this).attr('href'),function(data){
            if($.isPlainObject(data)){
                show_msg(data);
            }else{
                $('#new_content').html(data);
            }
        });
        e.preventDefault();
    });
    $('form[role="form"]').validator({
        rules:{
            realname:[/^[\u0391-\uFFE5\w ]+$/, "{:L('JS_INPUT_INFO')}"],
            mremote:function(element,params){
                var pv = $('[name="'+params+'"]').val();
                if(pv==''){
                    return $.ajax({
                        type:'post',
                        url:'{:U('Menu/checkAction')}',
                        data:element.name+'='+element.value+'&'+params+'=index',
                        success:function(d){
                            window.console && console.log(d);
                        }
                    });
                }
            }
        },
        fields:{
            'realname[{$Think.LANG_SET}]':'required;realname;length[2~20]',
            model:{
                rule:'required;letters;length[3~20];mremote[action]',
                must:true
            },
            action:'letters;length[3~20];remote[{:U('Menu/checkAction')}, model]',
            data:'length[~50]',
            remark:'length[~100]'
        },
        valid:function(form){
            $.ajax({
                type: 'POST',
                url: '{:U('Menu/'.ACTION_NAME)}',
                data:$(form).serialize(),
                success: function(data){
                    show_msg(data);
                }
            });
        }
    });
</script>